#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  first.py
#       Author @  Huoty
#  Create date @  2016-07-02 13:02:57
#  Description @
# *************************************************************

class Foo(object):
    __slots__ = ("a", "b")

    def __init__(self, a, b):
        self.a = a
        self.b = b

    @property
    def bar(self):
        return self.a + self.b

    @bar.setter
    def bar(self, value):
        if value < 0:
            raise ValueError("Negative value not allowed: %s" % value)
        self.a = self.b = value

    @bar.deleter
    def bar(self):
        pass


# Script starts from here

if __name__ == "__main__":
    obj = Foo(1, 2)
    print obj.bar
    obj.bar = 200
    print obj.bar
    del obj.bar
    obj.c = 100

